<%= javascript_include_tag 'jscalendar/calendar.js' , 'jscalendar/calendar-setup.js', 'jscalendar/lang/calendar-en.js' %>
<%= javascript_include_tag 'calendar.js' %>
<style type="text/css">@import url(/javascripts/jscalendar/calendar-win2k-1.css);</style>

<% form_tag('/calendar/create') do -%>
<table>
<tr><td>Project</td><td><%= select('new', 'project_id', session['user'].projects.sort_by{|p| [p.name.upcase]}.map{|p| [p.name,p.id]}, {:include_blank => true},{:onchange=>"new Ajax.Updater('events', '/calendar/select_project/'+this.value, {asynchronous:true, evalScripts:true})"}) %>
Select a project to display tasks</td></tr>
<tr><td>Title</td><td><%= text_field('new', 'title') %></td></tr>
<tr><td>Date</td><td><%= text_field('new', 'date') %></td></tr>
<tr><td>&nbsp;</td><td><%= submit_tag('Add event',{:class => 'button'}) -%></td></tr>
</table><br/>
<% end -%>
<br/>
<div id="events"><%=render(:action=>'select_project')%></div>
	

<script>
Calendar.setup({
   inputField     :    "new_date",
   ifFormat       :    "%Y-%m-%d",
   showsTime      :    false
   });
</script>
